package com.example.advice;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author wuyuhong
 * @date 2021/06/08 22:07
 **/
//@controllerAdvices //@controller
@RestControllerAdvice//@RestController

public class MyGlobalExcpetion {
    @ExceptionHandler(Exception.class)//跟的什么异常就处理什么异常
    public String customExceptionMessage(Exception e){
        return  e.getMessage();
    }
}
